Skip to main content

All Questions

1vote
2answers
92views

XMLERR: Element '=").*?(?=")</regex' not closed while using lookaround

I am trying to use lookaround element in PCRE2 regex for Wazuh tool, i need to match strings which are in double quotes and made the below regex however it looks its picking up "<" ...
Atul's user avatar
  • 1,901
0votes
3answers
205views

How to get all numbers AND IPs from string using regex?

Let's say I have the following example string: <ETH0_IP><![CDATA[10.0.100.10]]></ETH0_IP> I would like to extract the first number and the IP in the following format: 0 10.0.100.10 ...
k.Cyborg's user avatar
0votes
4answers
6kviews

How to extract a portion of an XML tag value in a Bash script

I have a XML file like this (A.xml) : <?xml version="1.0"?> <RunParameters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
nstatam's user avatar
-1votes
2answers
76views

sed command succesfuly find and replace in file , bit erasing everything in the new file

i have this xml text in file named test2.txt <This is a line of text with a year=2020 month=12 in it This line of text does not have a year or month in it This year=2021 is the current year the ...
user63898's user avatar
3votes
4answers
1kviews

sed regex fails to capture the entire paragraph containing the pattern

I have this XML file (example) <This is a line of text with a year=2020 month=12 in it This line of text does not have a year or month in it This year=2021 is the current year the current month=1 ...
user63898's user avatar
0votes
1answer
200views

How to Search XML Block and Delete the same

This is my XML. <configGroup> <type>SERVER_CONFIG</type> <configProperty id="Server48"> <configProperty> <name>Server Name</name> <...
cotton's user avatar
0votes
1answer
217views

Regex groups not greedy?

Are sed matches always greedy? I am trying to use sed to append an XML comment into an XML file as early as possible, which is right after the XML declaration if there is one. Something like this, ...
Jirka Hanika's user avatar
0votes
1answer
415views

Script to remove all modules in pom.xml except the one with the highest number

Question I have a huge pom.xml from a Talend DI/ESB project, where it was possible to have multiple lines for the same module with different Talend specific versions (don't even ask for that :-( ) ...
aw-think's user avatar
1vote
3answers
613views

Linux sed regex escape

I use sed -i to replace the port value in a xml file, <property name="port" value="8954" /> But I don't know how escape the regex, my regex is below. (?<=name="port"\s+value=")\d+(?=") my ...
happyshark's user avatar
1vote
1answer
726views

How to find max value from specific XML element using a Perl one liner?

I have an XML file with the following syntax <element> <id>0</id> <tag1>something</tag1> ... <tagn>something</tagn> </element> <element> ...
mrdatamx's user avatar
0votes
2answers
394views

Delete line only if previous line has tag - sed ? or easier?

I'm facing a rather newbie problem and caught my ears around it :( I have a file with xml tags and I want that when I find: </ac:image> </a> the </ac:image> one followed by an ...
Mihai's user avatar
0votes
1answer
530views

Complex string replace - multiple files, multiple different strings, must include certain text

I have a number of XML files (Atlassian Confluence space exports FYI), that I need to parse through to replace certain strings, as long as the line begins with a set string. Here is an example of a ...
davodinkum's user avatar
7votes
1answer
14kviews

$1 not working with sed

I have a bunch of files that contain XML tags like: <h> PIDAT <h> O I need to delete everything what comes after the first <h> in that line, so I can get this: <h> For ...
Carolina Cárdenas's user avatar
0votes
3answers
475views

Sed/awk Regex : XML feed

I'm searching for a specific REGEX, 3 days I'm trying and trying but not founding the right answer. I need to delete specific parts of an xml feed, I tried with sed, awk and it's not working right. ...
w4rell's user avatar
1vote
3answers
3kviews

Using sed to get specific text from XML file

Not sure why I'm not getting this. I've been searching and testing my command for a couple hours and I'm not getting anywhere. The text is: <?xml version="1.0" encoding="UTF-8" ...
Justin's user avatar

153050per page
close